﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ThinkGeo.MapSuite.Core;
using ThinkGeo.MapSuite.WebEdition;

namespace WebApplication2
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["task"] == "QHV" && Request.QueryString["id"] == "1")
            {

            }
            if (!Page.IsPostBack)
            {

                Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"));
                Map1.CurrentExtent = new RectangleShape(11574062.93759, 2568107.72308, 11577574.26150, 2568107.72308);
                Map1.MapUnit = GeographyUnit.Meter;
                GoogleOverlay mapgg4 = new GoogleOverlay();
                mapgg4.GoogleMapType = GoogleMapType.Hybrid;
                mapgg4.Name = "Vệ tinh";
                Map1.CustomOverlays.Add(mapgg4);

                GoogleOverlay mapgg3 = new GoogleOverlay();
                mapgg3.GoogleMapType = GoogleMapType.Normal;
                mapgg3.Name = "Giao thông";
                Map1.CustomOverlays.Add(mapgg3);

                GoogleOverlay mapgg2=new GoogleOverlay();
                mapgg2.GoogleMapType=GoogleMapType.Physical;
                mapgg2.Name = "Độ cao";
                Map1.CustomOverlays.Add(mapgg2);
                

               

                Map1.MapTools.OverlaySwitcher.Enabled = true;

                Map1.MapTools.LoadingImage.Enabled = true;
                Map1.MapTools.LoadingImage.Width = 64;
                Map1.MapTools.LoadingImage.Height = 64;
                Map1.MapTools.LoadingImage.ImageUri = new Uri(new Uri(Request.Url.AbsoluteUri), @"images\loading.gif");
                LoadLayer();
            }  
        }
        private ZoomLevelSet CustomZoomlevelSets()
        {
            ZoomLevelSet myZoomlevelset = new ZoomLevelSet();

            GoogleMapsZoomLevelSet googlezoomlevelsets = new GoogleMapsZoomLevelSet();
            foreach (ZoomLevel item in googlezoomlevelsets.GetZoomLevels().Skip(13).Take(13))
            {
                myZoomlevelset.CustomZoomLevels.Add(item);
            }

            return myZoomlevelset;
        }
        private void LoadLayer()
        {
            Map1.ZoomLevelSet = CustomZoomlevelSets();
            //Layer Lòng đường
            //Layer Vỉa hè duc
            //Layer tim đường
            //Layer Chi giới xây dựng
            //Layer Chi giới đường đo
            //Layer Hach dat
            //Layer T5 chia lô 1
            //Layer thuyhe
            //Layer Nha 1
            //Layer Hướng đường
            Proj4Projection proj3857 = new Proj4Projection();
            proj3857.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(3857);
            proj3857.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
            Proj4Projection proj4 = new Proj4Projection();
            proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326);
            proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
            proj4.Open();
            WmsOverlay wms = new WmsOverlay("WMS Overlay");
            wms.Parameters.Add("layers", "Countries02");
            wms.Parameters.Add("STYLE", "SIMPLE");
            wms.ServerUris.Add(new Uri("http://wmssamples.thinkgeo.com/WmsServer.aspx"));
            wms.TileType = TileType.MultipleTile;
            wms.TileHeight = 256;
            wms.TileWidth = 256;
            wms.Name = "Không nền";

            Map1.CustomOverlays.Add(wms);
            ////Layer Tieucanh
            ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer(MapPath("~/Data/Polyline/Duong.shp"));
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#585655"), 1, GeoColor.FromHtml("#FFB2E8"), 0, true);
            ////shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, 212, 220, 184), GeoColor.FromArgb(255, 132, 132, 154), 1);
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            shapeFileFeatureLayer.FeatureSource.Projection = proj4;

            ////Layer Vỉa hè duc
            //ShapeFileFeatureLayer Netviahe_polyline = new ShapeFileFeatureLayer(MapPath("~/Data/Polyline/Netviaheduc.shp"));
            //Netviahe_polyline.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#585655"), 1, GeoColor.FromArgb(255, 133, 0, 133), 0, true);
            //Netviahe_polyline.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            //Netviahe_polyline.FeatureSource.Projection = proj4;

            //Layer Chi giới xây dựng
            ShapeFileFeatureLayer Chigioixaydung_polyline = new ShapeFileFeatureLayer(MapPath("~/Data/Polyline/ChigioiXD.shp"));
            Chigioixaydung_polyline.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#FF7F00"), 2, GeoColor.FromHtml("#B1B1B1"), 0, true);
            Chigioixaydung_polyline.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            Chigioixaydung_polyline.FeatureSource.Projection = proj4;
            //Layer Chi giới đường đo
            ShapeFileFeatureLayer Chigioiduongdo_polyline = new ShapeFileFeatureLayer(MapPath("~/Data/Polyline/Chigioiduongdo.shp"));
            Chigioiduongdo_polyline.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#FF7F00"), 2, GeoColor.FromHtml("#B1B1B1"), 0, true);
            Chigioiduongdo_polyline.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            Chigioiduongdo_polyline.FeatureSource.Projection = proj4;

            //Layer Hatch dat T1
            ShapeFileFeatureLayer HatchdatT1_polyline = new ShapeFileFeatureLayer(MapPath("~/Data/Polyline/HachDatT1.shp"));
            HatchdatT1_polyline.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#C7C7AF"), 1, GeoColor.FromArgb(255, 82, 0, 133), 0, true);
            HatchdatT1_polyline.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            HatchdatT1_polyline.FeatureSource.Projection = proj4;
            //Layer Tim duong
            ShapeFileFeatureLayer Nettimduong_polyline = new ShapeFileFeatureLayer(MapPath("~/Data/Polyline/NetTimduongmoi.shp"));
            Nettimduong_polyline.ZoomLevelSet.ZoomLevel19.DefaultLineStyle = LineStyles.StateBorder1;
            Nettimduong_polyline.ZoomLevelSet.ZoomLevel19.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            Nettimduong_polyline.FeatureSource.Projection = proj4;
            //Layer T5chialo
            ShapeFileFeatureLayer T5chialo_polyline = new ShapeFileFeatureLayer(MapPath("~/Data/Polyline/T5ChiaLo.shp"));
            T5chialo_polyline.ZoomLevelSet.ZoomLevel18.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#E600A9"), 1, GeoColor.FromHtml("#B1B1B1"), 0, true);
            T5chialo_polyline.ZoomLevelSet.ZoomLevel18.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            T5chialo_polyline.FeatureSource.Projection = proj4;

            //Layer Nha 
            ShapeFileFeatureLayer Nha1 = new ShapeFileFeatureLayer(MapPath("~/Data/Polyline/Nha1.shp"));
            Nha1.ZoomLevelSet.ZoomLevel19.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 130, 130, 130), 1, GeoColor.FromArgb(255, 130, 130, 130), 0, true);
            //shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, 212, 220, 184), GeoColor.FromArgb(255, 132, 132, 154), 1);
            Nha1.ZoomLevelSet.ZoomLevel19.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            Nha1.FeatureSource.Projection = proj4;
            //Layer 28
            ShapeFileFeatureLayer Hatchdatt1_polygon = new ShapeFileFeatureLayer(MapPath("~/Data/Polygon/28.shp"));
            Hatchdatt1_polygon.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromHtml("#F7EFEF"), GeoColor.FromArgb(255, 132, 132, 154), 0);
            Hatchdatt1_polygon.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            Hatchdatt1_polygon.FeatureSource.Projection = proj4;

            // markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage = new WebImage(@"Pic/marker_squared_red.png", 21, 25);
            //Layer bai do xe
            ShapeFileFeatureLayer Baidoxe_polygon = new ShapeFileFeatureLayer(MapPath("~/Data/tk5/05_GiaoThong/BaiDatDoXe_PLG.shp"));
            Baidoxe_polygon.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.SnowIce1;
            Baidoxe_polygon.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            Baidoxe_polygon.FeatureSource.Projection = proj4;

            //Layer bduonghientrang
            ShapeFileFeatureLayer Duonghientrang_polygon = new ShapeFileFeatureLayer(MapPath("~/Data/tk5/05_GiaoThong/DuongHienTrang_PLG.shp"));
            Duonghientrang_polygon.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromHtml("#E7D3EF"), GeoColor.FromHtml("#AD829C"), 1);
            Duonghientrang_polygon.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            Duonghientrang_polygon.FeatureSource.Projection = proj4;

            //Layer duong thiet ke moi
            ShapeFileFeatureLayer Duongthietkemoi_polygon = new ShapeFileFeatureLayer(MapPath("~/Data/tk5/05_GiaoThong/DuongThietKeMoi_PLG.shp"));
            Duongthietkemoi_polygon.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromHtml("#FFD7AD"), GeoColor.FromArgb(255, 132, 132, 154), 0);
            Duongthietkemoi_polygon.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            Duongthietkemoi_polygon.FeatureSource.Projection = proj4;

            //Layer DatCatXanh
            ShapeFileFeatureLayer DatCayXanh_polygon = new ShapeFileFeatureLayer(MapPath("~/Data/tk5/05_GiaoThong/DatCayXanh_PLG.shp"));
            DatCayXanh_polygon.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromHtml("#CEEFAD"), GeoColor.FromArgb(255, 132, 132, 154), 0);
            DatCayXanh_polygon.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            DatCayXanh_polygon.FeatureSource.Projection = proj4;

            //Layer tieucanh
            ShapeFileFeatureLayer tieucanh_polygon = new ShapeFileFeatureLayer(MapPath("~/Data/tk5/TieuCanh_Polygon.shp"));
            tieucanh_polygon.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromHtml("#CEEFAD"), GeoColor.FromArgb(255, 132, 132, 154), 0);
            tieucanh_polygon.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            tieucanh_polygon.FeatureSource.Projection = proj4;

            //Layer ViaHe
            ShapeFileFeatureLayer Viahe_polygon = new ShapeFileFeatureLayer(MapPath("~/Data/tk5/05_GiaoThong/ViaHe_PLG.shp"));
            Viahe_polygon.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromHtml("#CEB684"), GeoColor.FromArgb(255, 132, 132, 154), 0);
            Viahe_polygon.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            Viahe_polygon.FeatureSource.Projection = proj4;


            //POINT
            ShapeFileFeatureLayer TieuCanh_Point = new ShapeFileFeatureLayer(MapPath("~/Data/tk5/CayXanh_P.shp"));
            TieuCanh_Point.ZoomLevelSet.ZoomLevel18.DefaultPointStyle = new PointStyle(new GeoImage(Server.MapPath("~/Pic/tree.png")));
            TieuCanh_Point.ZoomLevelSet.ZoomLevel18.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            TieuCanh_Point.FeatureSource.Projection = proj4;

            LayerOverlay shapeOverlay = new LayerOverlay("TieuKhu5", false, TileType.MultipleTile);
            //shapeOverlay.ServerCache=new ServerCache(MapPath("~/ImageCache"));
            //shapeOverlay.ServerCache.CacheId = "TieuKhu5";
            //shapeOverlay.ClientCache = new ClientCache(new TimeSpan(5, 0, 0, 0));
            shapeOverlay.IsVisibleInOverlaySwitcher = false;
            //polygon
            shapeOverlay.Layers.Add(Hatchdatt1_polygon);
            shapeOverlay.Layers.Add(Baidoxe_polygon);
            shapeOverlay.Layers.Add(Duonghientrang_polygon);
            shapeOverlay.Layers.Add(Duongthietkemoi_polygon);
            shapeOverlay.Layers.Add(DatCayXanh_polygon);
            shapeOverlay.Layers.Add(tieucanh_polygon);
            shapeOverlay.Layers.Add(Viahe_polygon);
            //polyline
            shapeOverlay.Layers.Add(T5chialo_polyline);
            shapeOverlay.Layers.Add(Nha1);
            shapeOverlay.Layers.Add(shapeFileFeatureLayer);
            //shapeOverlay.Layers.Add(Netviahe_polyline);
            shapeOverlay.Layers.Add(Chigioixaydung_polyline);
            shapeOverlay.Layers.Add(HatchdatT1_polyline);
            shapeOverlay.Layers.Add(Nettimduong_polyline);

            //Point
            shapeOverlay.Layers.Add(TieuCanh_Point);



            //TK2
            string connectString = @"Data Source=GISLAB;Initial Catalog=TK2_GiaoThong;Integrated Security=True;User ID=sa;Password=abc123.";

            //Layer duong quy hoach
            //ShapeFileFeatureLayer DuongQuyHoach_Polygon = new ShapeFileFeatureLayer(MapPath("~/Data/tk2/GiaoThong/Polygon_DuongQH.shp"));
            MsSql2008FeatureLayer DuongQuyHoach_Polygon = new MsSql2008FeatureLayer(connectString, "Polygon_DuongQH", "ID");
            DuongQuyHoach_Polygon.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 191, 245, 233), GeoColor.FromArgb(255, 132, 132, 154), 0);
            DuongQuyHoach_Polygon.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            DuongQuyHoach_Polygon.Srid = 4326;
            DuongQuyHoach_Polygon.FeatureSource.Projection = proj4;

            //lyr cong trinh xay dung
            //ShapeFileFeatureLayer CongTrinh = new ShapeFileFeatureLayer(MapPath(@"~/Data/tk2/GiaoThong/CongTrinh.shp"));
            MsSql2008FeatureLayer CongTrinh = new MsSql2008FeatureLayer(connectString, "CongTrinh", "ID");
            CongTrinh.ZoomLevelSet.ZoomLevel18.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 130, 130, 130), 1, GeoColor.FromArgb(255, 130, 130, 130), 0, true);
            //shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, 212, 220, 184), GeoColor.FromArgb(255, 132, 132, 154), 1);
            CongTrinh.ZoomLevelSet.ZoomLevel18.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            CongTrinh.Srid = 4326;
            CongTrinh.FeatureSource.Projection = proj4;

            //Layer đường len xuong ham
            //ShapeFileFeatureLayer DuongLenXuongHam = new ShapeFileFeatureLayer(MapPath("~/Data/tk2/GiaoThong/DuongLenXuongHam.shp"));
            MsSql2008FeatureLayer DuongLenXuongHam = new MsSql2008FeatureLayer(connectString, "DuongLenXuongHam", "ID");
            DuongLenXuongHam.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 0, 51, 145), 1, GeoColor.FromArgb(255, 0, 51, 145), 0, true);
            //shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, 212, 220, 184), GeoColor.FromArgb(255, 132, 132, 154), 1);
            DuongLenXuongHam.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            DuongLenXuongHam.Srid = 4326;
            DuongLenXuongHam.FeatureSource.Projection = proj4;

            //Layer giao thong 6m
            //ShapeFileFeatureLayer GiaoThong_6m = new ShapeFileFeatureLayer(MapPath("~/Data/tk2/GiaoThong/GiaoThong_6m.shp"));
            MsSql2008FeatureLayer GiaoThong_6m = new MsSql2008FeatureLayer(connectString, "GiaoThong_6m", "ID");
            GiaoThong_6m.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#C7C7AF"), 1, GeoColor.FromArgb(255, 82, 0, 133), 0, true);
            GiaoThong_6m.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            GiaoThong_6m.Srid = 4326;
            GiaoThong_6m.FeatureSource.Projection = proj4;

            //Layer giao thong ngoai quy hoach
            //ShapeFileFeatureLayer GiaoThongNgoaiQuyHoach = new ShapeFileFeatureLayer(MapPath("~/Data/tk2/GiaoThong/GiaoThong_NgoaiQuyHoach.shp"));
            MsSql2008FeatureLayer GiaoThongNgoaiQuyHoach = new MsSql2008FeatureLayer(connectString, "GiaoThong_NgoaiQuyHoach", "ID");
            GiaoThongNgoaiQuyHoach.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#A59A8C"), 1, GeoColor.FromArgb(255, 133, 0, 133), 0, true);
            GiaoThongNgoaiQuyHoach.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            GiaoThongNgoaiQuyHoach.Srid = 4326;
            GiaoThongNgoaiQuyHoach.FeatureSource.Projection = proj4;

            //giao thong quy hoach
            //ShapeFileFeatureLayer GiaoThong_QuyHoach = new ShapeFileFeatureLayer(MapPath("~/Data/tk2/GiaoThong/GiaoThong_QuyHoach.shp"));
            MsSql2008FeatureLayer GiaoThong_QuyHoach = new MsSql2008FeatureLayer(connectString, "GiaoThong_QuyHoach", "ID");
            GiaoThong_QuyHoach.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#A59A8C"), 1, GeoColor.FromArgb(255, 133, 0, 133), 0, true);
            GiaoThong_QuyHoach.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            GiaoThong_QuyHoach.Srid = 4326;
            GiaoThong_QuyHoach.FeatureSource.Projection = proj4;

            //tim duong quy hoach
            //ShapeFileFeatureLayer TimDuong_QuyHoach = new ShapeFileFeatureLayer(MapPath("~/Data/tk2/GiaoThong/GiaoThongQuyHoach_timDuong.shp"));
            MsSql2008FeatureLayer TimDuong_QuyHoach = new MsSql2008FeatureLayer(connectString, "GiaoThongQuyHoach_timDuong", "ID");
            TimDuong_QuyHoach.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.StateBorder1;
            TimDuong_QuyHoach.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            TimDuong_QuyHoach.Srid = 4326;
            TimDuong_QuyHoach.FeatureSource.Projection = proj4;

            //ranh gioi tang ham
            //ShapeFileFeatureLayer RanhGioiTangHam = new ShapeFileFeatureLayer(MapPath("~/Data/tk2/GiaoThong/RanhGioiTangHam.shp"));
            MsSql2008FeatureLayer RanhGioiTangHam = new MsSql2008FeatureLayer(connectString, "RanhGioiTangHam", "ID");
            RanhGioiTangHam.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 0, 166, 166), 1, GeoColor.FromArgb(255, 0, 166, 166), 0, true);
            RanhGioiTangHam.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            RanhGioiTangHam.Srid = 4326;
            RanhGioiTangHam.FeatureSource.Projection = proj4;

            //ranh roi quy hoach
            //ShapeFileFeatureLayer RanhGioiQuyHoach = new ShapeFileFeatureLayer(MapPath("~/Data/tk2/GiaoThong/RanhGioiQuyHoach.shp"));
            MsSql2008FeatureLayer RanhGioiQuyHoach = new MsSql2008FeatureLayer(connectString, "RanhGioiQuyHoach", "ID");
            RanhGioiQuyHoach.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.InternationalBorder1;
            RanhGioiQuyHoach.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            RanhGioiQuyHoach.Srid = 4326;
            RanhGioiQuyHoach.FeatureSource.Projection = proj4;

            //add lyr vao 
            LayerOverlay staticOverlay = new LayerOverlay("TieuKhu2", false, TileType.MultipleTile);
            staticOverlay.TileHeight = 256;
            staticOverlay.TileWidth = 256;
            staticOverlay.ServerCache = new ServerCache(MapPath("~/ImageCache"));
            staticOverlay.IsVisibleInOverlaySwitcher = false;
            staticOverlay.Layers.Add("DuongQuyHoach_Polygon", DuongQuyHoach_Polygon);
            staticOverlay.Layers.Add("CongTrinh", CongTrinh);
            staticOverlay.Layers.Add("DuongLenXuongHam", DuongLenXuongHam);
            staticOverlay.Layers.Add("GiaoThong_6m", GiaoThong_6m);
            staticOverlay.Layers.Add("GiaoThongNgoaiQuyHoach", GiaoThongNgoaiQuyHoach);
            staticOverlay.Layers.Add("GiaoThong_QuyHoach", GiaoThong_QuyHoach);
            staticOverlay.Layers.Add("TimDuong_QuyHoach", TimDuong_QuyHoach);
            staticOverlay.Layers.Add("RanhGioiQuyHoach", RanhGioiQuyHoach);
            staticOverlay.Layers.Add("RanhGioiTangHam", RanhGioiTangHam);

            //shapeOverlay.TransitionEffect = TransitionEffect.None;
            // shapeOverlay.Name = "Bản đồ giao thông và chỉ giới xây dựng.";

            InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer();

            //highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, 60, 180, 60), GeoColor.GeographicColors.DeepOcean);
            highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#B5D3FF"), 5, GeoColor.FromHtml("#D6D3C6"), 1, true);
            highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay dynamicOverlay = new LayerOverlay("HightLightDynamicOverlay");
            dynamicOverlay.IsVisibleInOverlaySwitcher = false;
            dynamicOverlay.Layers.Add("HighLightLayer", highlightLayer);
            dynamicOverlay.IsBaseOverlay = false;

            //Map1.ZoomLevelSet = CustomZoomlevelSets();
            Map1.CustomOverlays.Add(shapeOverlay);
            Map1.CustomOverlays.Add(staticOverlay);
            Map1.CustomOverlays.Add(dynamicOverlay);

        }
        

        protected void btn_success_OnServerClick(object sender, EventArgs e)
        {
            
        }

        protected void btn_info_OnServerClick(object sender, EventArgs e)
        {
            
        }

        
        protected void list_nav_OnLoad(object sender, EventArgs e)
        {
            listnav.InnerHtml = "<li class='active'>" +
                            "<a href='#' class='dropdown-toggle'>" +
                                "<i class='icon-map-QHV'></i>" +
                                "<span class='menu-text'> Bản đồ quy hoạch</span>" +
                                "<b class='arrow icon-angle-down'></b>" +
                            "</a>" +
                        "<ul class='submenu'>" +
                        "<li>" +
                            "<a href='?task=QHV&id=1'>" +
                                "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Vị trí và mối liên hệ vùng</span>" +
                            "</a>" +
                        "</li>" +

                        "<li>" +
                            "<a href='#'>" +
                                "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Hiện trạng phân bố dân cư và sử dụng đất</span>" +
                            "</a>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#'>" +
                                "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Định hướng phát triển không gian</span>" +
                            "</a>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#'>" +
                                "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Hiện trạng cấp điện</span>" +
                            "</a>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#'>" +
                                "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Định hướng phát triển hệ thống cấp điện</span>" +
                            "</a>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#'>" +
                                "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Hiện trạng cấp nước</span>" +
                            "</a>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#'>" +
                                "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Định hướng phát triển hệ thống cấp nước</span>" +
                            "</a>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#'>" +
                                "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Hiện trạng chuẩn bị kỹ thuật</span>" +
                            "</a>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#' class='dropdown-toggle'>" +
                                 "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Hiện trạng giao thông</span>" +
                                "<b class='arrow icon-angle-down'></b>" +
                            "</a>" +
                            "<ul class='submenu'>" +
                                                "<li>" +
                                                    "<a href='#'>" +
                                                        "<i class='icon-double-angle-right'></i>" +
                                                        "Bản đồ ảnh" +
                                                    "</a>" +
                                                "</li>" +
                                                "<li>" +
                                                    "<a href='#'>" +
                                                        "<i class='icon-double-angle-right'></i>" +
                                                        "Bản đồ số" +
                                                    "</a>" +
                                                "</li>" +
                            "</ul>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#' class='dropdown-toggle'>" +
                                 "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Định hướng phát triển giao thông</span>" +
                                "<b class='arrow icon-angle-down'></b>" +
                            "</a>" +
                            "<ul class='submenu'>" +
                                                "<li>" +
                                                    "<a href='#'>" +
                                                        "<i class='icon-double-angle-right'></i>" +
                                                        "Bản đồ ảnh" +
                                                    "</a>" +
                                                "</li>" +
                                                "<li>" +
                                                    "<a href='#'>" +
                                                        "<i class='icon-double-angle-right'></i>" +
                                                        "Bản đồ số" +
                                                    "</a>" +
                                                "</li>" +
                            "</ul>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#'>" +
                                "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Hiện trạng môi trường</span>" +
                            "</a>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#'>" +
                                 "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Đánh giá môi trường chiến lược</span>" +
                            "</a>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#'>" +
                                 "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Hiện trạng thoát nước thải và vệ sinh môi trường</span>" +
                            "</a>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#'>" +
                                "<i class='icon-double-angle-right'></i>" +
                                "<span class='menu-text'> Định hướng phát triển hệ thống thoát nước thải, quản lý chất thải rắn, nghĩa trang</span>" +
                            "</a>" +
                        "</li>" +
                        "</ul>" +
                        "</li>" +
                        "<li>" +
                            "<a href='#'>" +
                                "<i class='icon-document-thinkgeo'></i>" +
                                "<span class='menu-text'> Tài liệu, văn bản</span>" +
                            "</a>" +
                        "</li>";
        }
    }
}